﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using ZBJF.Warranty.Common.Common;
using ZBJF.Warranty.Common.Enums.SocketEnum;
using ZBJF.Warranty.Model.ViewModel.SocketModel;
using ZBJF.Warranty.WeiXin;

namespace ZBJF.Warranty.H5.Controllers
{
    public class WeiXinApiController : ApiController
    {
        [HttpGet]
        public ResultModel GetAccessToken()
        {
            string data = WeiXinHelper.GetAccessToken();
            if (string.IsNullOrEmpty(data))
                return new ResultModel(false, "获取失败", CodeStateEnum.Failed);
            else
                return new ResultModel(true, "获取成功", CodeStateEnum.Success, NetCryptoHelper.AesEncrypt(data, "zbjf_accessToken_20180109_~!@#$%"));

        }

    }
}